﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MathematicallySafe.HeadCounter.Common;
using MathematicallySafe.HeadCounter.ViewModels;

namespace MathematicallySafe.HeadCounter.Views
{
    /// <summary>
    /// Interaction logic for RaiderGearView.xaml
    /// </summary>
    public partial class RaiderGearView : UserControl
    {
        public RaiderGearView()
        {
            InitializeComponent();
        }

        public RaiderDetailedViewModel ViewModel
        {
            get { return DataContext as RaiderDetailedViewModel; }
        }

        private void HyperlinkOnRequestNavigate(object sender, RequestNavigateEventArgs e)
        {
            Utilities.HyperlinkRequestNavigate(sender, e);
        }

        private void Image_MouseEnter(object sender, MouseEventArgs e)
        {
            // todo work out why this is not working and fix it properly.

            // The tooltip binding does not refire when we select a different raider so we end up
            // with the tooltips for the previous raider's gear.  Possibly this is something to do with
            // the tooltip being a placement target and not in teh visual tree?
            // Anyway this hack fixed it for now (and just fire all of them from one handler for simplicity's sake).

            OffHandToolTip.Content = ViewModel.OffHandItem;
            HeadToolTip.Content = ViewModel.HeadItem;
            ShoulderToolTip.Content = ViewModel.ShoulderItem;
            NeckToolTip.Content = ViewModel.NeckItem;
            BackToolTip.Content = ViewModel.BackItem;
            ChestToolTip.Content = ViewModel.ChestItem;
            WristToolTip.Content = ViewModel.WristItem;
            HandsToolTip.Content = ViewModel.HandsItem;
            WaistToolTip.Content = ViewModel.WaistItem;
            LegsToolTip.Content = ViewModel.LegsItem;
            FeetToolTip.Content = ViewModel.FeetItem;
            Finger1ToolTip.Content = ViewModel.Finger1Item;
            Finger2ToolTip.Content = ViewModel.Finger2Item;
            Trinket1ToolTip.Content = ViewModel.Trinket1Item;
            Trinket2ToolTip.Content = ViewModel.Trinket2Item;
            MainHandToolTip.Content = ViewModel.MainHandItem;
            OffHandToolTip.Content = ViewModel.OffHandItem;
            RangedToolTip.Content = ViewModel.RangedItem;
        }
    }
}
